package com.uu.main.callback

import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.listener.OnItemChildClickListener
import java.util.*

abstract class OnNoDoubleItemChildClickListener: OnItemChildClickListener {

    companion object {
        private var lastClickTime: Long = 0L
        private const val MIN_CLICK_DELAY_TIME = 500L
    }

    override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
        val currentTime = Calendar.getInstance().timeInMillis
        if (currentTime - lastClickTime < MIN_CLICK_DELAY_TIME) {
            return
        }
        lastClickTime = currentTime

        onNoDoubleClick(adapter, view, position)
    }

    abstract fun onNoDoubleClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int)

}